import { Router } from 'express'
import { getCurrentUser, updateUser, updateAvatar } from '../controllers/user'
import { auth } from '../middleware/auth'
import multer from 'multer'

const router = Router()
const upload = multer({ dest: 'uploads/' }) // 配置文件上传

// 获取当前用户信息
router.get('/me', auth, getCurrentUser)

// 更新用户信息
router.put('/me', auth, updateUser)

// 更新头像
router.post('/avatar', auth, upload.single('avatar'), updateAvatar)

export default router 